const message = {
  toast: (title, duration = 2000) => {
    return uni.showToast({
      title,
      duration,
    });
  },
  toastError: (title, duration = 2000) => {
    return uni.showToast({
      title,
      icon: "error",
      duration,
    });
  },
  loading: (title = "加载中", duration = 2000) => {
    uni.showLoading({ title, mask: true });

    duration &&
      setTimeout(function () {
        uni.hideLoading();
      }, duration);
    return uni.hideLoading;
  },
  deleteModal: (content, success) => {
    return uni.showModal({
      title: "提示",
      content: content,
      confirmColor: "#dd524d",
      success: function (res) {
        res.confirm && success();
      },
    });
  },
};

export default message;
